package com.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 每一行代码，都是改变世界的力量
 *
 * @author 郭帅
 * @date 2021/11/19 9:25 下午
 */
public class InvocationHandlerImpl implements InvocationHandler {

    private Object subject;

    public InvocationHandlerImpl(Object subject) {
        this.subject = subject;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("调用之前！");
        method.invoke(subject, args);
        System.out.println("调用之后！");
        return null;
    }

}
